<template>
  <div class="child1">
    <h1>我是Child1组件</h1>
    <h3>我有一个玩具：{{toy}}</h3>
    <h3 v-show="computer">弟弟给我的电脑是:{{computer}}</h3>
  </div>
</template>

<script>
  export default {
    name:'Child1',
    data() {
      return {
        toy:'小霸王游戏机',
        computer:''
      }
    },
    methods: {
      zouqi(value){
        console.log('Child1',value)
        this.computer = value
      }
    },
    beforeDestroy() {
      this.$bus.$off('wan')
    },
    mounted() {
      // console.log('@',this.$bus)
      this.$bus.$on('wan',this.zouqi)
    },
  }
</script>

<style scoped>
  .child1 {
    background-color: skyblue;
    padding: 20px;
  }
</style>